package oop4.zhuanxing;

import oop4.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class Xiangshang {
    public static void main(String[] args) {
        Pet p = new Dog("大黄", 88, 66, "公", "藏獒");
        p.print();
        Object o = new Dog("二黄", 88, 66, "公", "边牧");
        //o.print();
        Dog d = (Dog) o;
        d.print();
        d.catchMouse("小灰灰");
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        o=new Penguin("小蓝企鹅",99,88,"公");
        if (o instanceof Penguin) {
            Penguin pg = (Penguin) o;//错误
            pg.swim();
        }else{
            System.out.println("不是企鹅");
        }
//        Penguin pg=(Penguin) o;//错误
//        pg.swim();
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>");
    }
}
